package com.idp;

import com.idp.service.MyUserDetailsService;
import org.mybatis.spring.annotation.MapperScan;
import org.opensaml.DefaultBootstrap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;

@SpringBootApplication
@ServletComponentScan
@MapperScan({"com.sub.mapper"})
@EnableGlobalMethodSecurity(securedEnabled=true)  // 启动@Secured注解
public class Application extends SpringBootServletInitializer {

    static {
        try {
            DefaultBootstrap.bootstrap();
        } catch (Exception e) {
            Logger logger = LoggerFactory.getLogger(Application.class);
            logger.error("bootstrap failed !", e);
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        new SpringApplicationBuilder(Application.class)
                .properties("server.port=" + 4567)
                .run(args);
    }

    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(Application.class);
    }
}
